#ifndef     __MQTT_CONN_H
#define     __MQTT_CONN_H

#include <mqtt/client.h>
#include <memory>

namespace server {

struct MqttInfo {
    const std::string url;
    const std::string client_id;
    const std::string username;
    const std::string password;
};

class MqttConn : public mqtt::callback {

public:
    void connect(const MqttInfo& info);

private:
    void on_message_arrived(mqtt::const_message_ptr msg);
    void on_connect_lost(const std::string& cause);

private:
    std::unique_ptr<mqtt::client> m_client;
};

}

#endif
